#-*- coding: utf8 -*-
from tutor.script import *
from tutor.plugin.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')
a = M.a

# parâmetros iniciais
r = oneof(1,2,3,4,5) * oneof(-1, 1)
s = oneof(1,2,3,4,5) * oneof(-1, 1)

F = (s*x + r*y) * _i + (s*y - r*x) * _j
Fx = M.coeff(F, _i)
Fy = M.coeff(F, _j)
print('F: %s' % F)

# parametrizaçao do caminho
X = a * cos(t)
Y = a * sin(t)
Vx, Vy = ( M.diff(f, t) for f in [X, Y] )
FFx, FFy = subs(x==X, y==Y, [Fx, Fy])
v = a

# Work
work = 2 * M.Pi * M.simplify(M.expand(Vx * FFx + Vy * FFy))
wCCW = -work
print('work: %s' % work)

# wProd
wProd = 2*M.Pi * M.simplify(M.expand(FFx**2 + FFy**2))
wProdCCW = - wProd
print('wProd: %s' % wProd)
